using System;
using System.ComponentModel;
using System.Linq;

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace ApiTest2.Entitys
{
    /// <summary>
    /// 后台用户
    /// </summary>  
    /// <remarks>
    /// <![CDATA[ENGINE=InnoDB  COMMENT='后台用户']]>
    /// </remarks>
    [DbSource("Default"), Serializable]
    public class SysAdmin
    {
        /// <summary>
        /// admin_id
        /// </summary>
        /// <remarks>
        /// <![CDATA[int NOT NULL COMMENT '']]>
        /// </remarks>
        [Primary(Automatic = true)]
        public int AdminId { get; set; }

        /// <summary>
        /// 系统用户
        /// </summary>
        /// <remarks>
        /// <![CDATA[bit(1) NOT NULL COMMENT '系统用户']]>
        /// </remarks>
        [Column(1, false)]
        [DisplayName("系统用户")]
        public bool IsSys { get; set; }

        /// <summary>
        /// 角色组 *array*
        /// </summary>
        /// <remarks>
        /// <![CDATA[text DEFAULT NULL COMMENT '角色组 *array*']]>
        /// </remarks>
        [JsonConverter(typeof(ArrayJsonConverter))]
        [Column]
        [DisplayName("角色组")]
        public string RoleIds { get; set; }

        /// <summary>
        /// 账号
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(31) NOT NULL COMMENT '账号']]>
        /// </remarks>
        [Column(31, false)]
        [DisplayName("账号")]
        public string UserName { get; set; }

        /// <summary>
        /// mobile
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(15) DEFAULT NULL COMMENT '']]>
        /// </remarks>
        [Column(15)]
        public string Mobile { get; set; }

        /// <summary>
        /// 密码 ***
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(255) DEFAULT NULL COMMENT '密码 ***']]>
        /// </remarks>
        [JsonIgnore]
        [Column(255)]
        [DisplayName("密码")]
        public string Password { get; set; }

        /// <summary>
        /// 昵称
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(63) DEFAULT NULL COMMENT '昵称']]>
        /// </remarks>
        [Column(63)]
        [DisplayName("昵称")]
        public string NickName { get; set; }

        /// <summary>
        /// 头像
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(63) DEFAULT NULL COMMENT '头像']]>
        /// </remarks>
        [Column(63)]
        [DisplayName("头像")]
        public string Avatar { get; set; }

        /// <summary>
        /// open_id
        /// </summary>
        /// <remarks>
        /// <![CDATA[varchar(64) DEFAULT NULL COMMENT '']]>
        /// </remarks>
        [Column(64)]
        public string OpenId { get; set; }

        /// <summary>
        /// 上次登录
        /// </summary>
        /// <remarks>
        /// <![CDATA[datetime DEFAULT NULL COMMENT '上次登录']]>
        /// </remarks>
        [Column]
        [DisplayName("上次登录")]
        public DateTime? LastLoginTime { get; set; }

        /// <summary>
        /// create_time
        /// </summary>
        /// <remarks>
        /// <![CDATA[datetime NOT NULL COMMENT '']]>
        /// </remarks>
        [Column(false)]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 锁定
        /// </summary>
        /// <remarks>
        /// <![CDATA[bit(1) NOT NULL COMMENT '锁定']]>
        /// </remarks>
        [Column(1, false)]
        [DisplayName("锁定")]
        public bool IsLock { get; set; }

        /// <summary>
        /// 是否删除 ***
        /// </summary>
        /// <remarks>
        /// <![CDATA[bit(1) NOT NULL COMMENT '是否删除 ***']]>
        /// </remarks>
        [JsonIgnore]
        [Column(1, false)]
        [DisplayName("是否删除")]
        public bool IsDel { get; set; }

    }
}
